<template>
  <el-dialog
    :title="title"
    :visible.sync="dialogFormVisible"
    width="500px"

  >
    <el-form ref="form" :model="form" :rules="rules" label-width="80px">

      <el-form-item label="新密码" prop="newpwd">
        <el-input v-model.trim="form.newpwd"  autocomplete="off"></el-input>

      </el-form-item>

    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="close">取 消</el-button>
      <el-button type="primary"  @click="save">确 定</el-button>
    </div>
  </el-dialog>
</template>

<script>
    import { resetting } from "@/api/personnel";
    export default {
        name: "Password",
        data() {
            return {
                title:"密码重置",
                list:[
                ],
                dialogFormVisible: false,
                form:{

                    newpwd:"",
                    uname:"",
                },
                rules: {
                    newpwd: [{ required: true, trigger: "blur", message: "请输入新的密码" }],

                },
            };
        },
        methods:{
            showEdit(row) {

                   this.form.uname=row.uname
                this.form.newpwd=""
                this.dialogFormVisible = true;
            },
            close() {

                this.dialogFormVisible = false;

            },
            save() {


                resetting(this.form).then(res =>{

                        console.log(res)
                    if(res.code==200){
                        this.$baseMessage("重置成功");
                        this.dialogFormVisible = false;
                    }else {
                        return false;
                    }

                }





                ).catch(err => console.log(err))
            },
        },
    }
</script>

<style scoped>

</style>
